The application model follows the MVC architecture. The generated application to be generated by the ROO meta-framework will consist of a domain Model (M) and a web tier containing Views (V) and Controllers (C)
This is the class diagram of the domain model for the application we are going to build:
The web tier usually consists of a number of controllers and a number of HTML views to have access to the controller functions from regular web browsers.
To know about creating the web tier: hint web mvc
Creating RESTful Spring MVC web controllers is quick and easy using Roo. Controllers can be made that automatically expose an entity. Alternately, we can create a stub, empty controller for you to finish off.
For the former, type 'web mvc setup' and hit ENTER followed by 'web mvc scaffold' and hit TAB three times. The --class is the controller name; it need not reflect an entity name. We suggest putting controllers under a '~.web' package to improve maintenance. You can also specify the --backingType the controller should expose.
Firslty we will generate the complete PizzaShop application just to test it. Later we will partly re-generate the application step-by-step with ROO, only to have a remoting layer that consists of a set of JSON-based RESTful web services.
From the command line interface, run:
$ mkdir sample
$ cd sample
$ roo
roo> script --file pizzashop.roo
roo> quit
$ mvn tomcat:run
(If running in Windows, use similar commands)